<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>学籍查询</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>

    <link href="/public/static/home/themes/css/login.css" rel="stylesheet">

</head>

<body>

<div class="login-logo circle text-center"></div>

<form name="forms" action="" onsubmit="return false;" method="post" class="login-cont">
    <ul>
        <li><input type="text" id="username" name="username" placeholder="请输查询人的姓名"></li>
        <li><input type="text" name="idcard" placeholder="请输查询人的身份证号" id="idcard"/>
    </ul>
    <a href="javascript:;" class="button text-center block" id="login">查 询</a>
</form>

<script src="/public/static/admin/layui/layui.js"></script>
<script type="text/javascript">
    layui.use('upload', function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer, upload = layui.upload; //独立版的layer无需执行这一句
        //登录
        $("#login").click(function () {
            //判断用户名是否为空
            if ($("#username").val() == "") {
                $("#username").focus();
                layer.msg("请输入查询人姓名", {time: 2000});
                return false;
            }
            //判断身份证号是否为空
            if ($("#idcard").val() == "") {
                $("#idcard").focus();
                layer.msg("请输入身份证号！", {time: 2000});
                return false;
            }
            $.post("{:url('center/DoCenterLogin')}", {
                username: $("#username").val(),
                idcard: $("#idcard").val(),
            }, function (data) {
                if (data.url) {
                    layer.msg(data.msg, {time: 2000}, function () {
                        window.location.href = data.url;
                    });
                    return false;
                } else {
                    layer.msg(data.msg, {time: 2000});
                    return false;
                }
            });
        });
    });
</script>

</body>
</html>
